import {HttpClient} from '@angular/common/http';
import {Injectable} from '@angular/core';
import {Observable} from "rxjs/Observable";

/*
  Generated class for the WebcastPlayBackListProvider provider.

  See https://angular.io/guide/dependency-injection for more info on providers
  and Angular DI.
*/
@Injectable()
export class WebCastPlayBackListProvider {

    private getPlayBackUrl = `/livestreaming/v1/playbacklist/`;
    private getVideoTypeUrl = `/livestreaming/v1/playbacktype`;

    constructor(public http: HttpClient) {

    }

    getPlayBackList(params): Observable<any> {
        console.log("log ...");
        let url = this.getPlayBackUrl+params.order;
        if(params.type === 0){
            url+="&";
        }else{
            url+="&"+params.type;
        }
        if (params.starttime) {
            url += "&" + params.starttime;
        }else{
            url += "&";
        }
        if (params.endtime) {
            url += "&" + params.endtime;
        }else{
            url += "&";
        }
        return this.http.get(url);
    }

    getVideoTypes():Observable<any>{
        return this.http.get(this.getVideoTypeUrl);
    }

}
